package top.appx.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import top.appx.entity.EmailEntity;
import top.appx.qo.EmailQO;
import top.appx.service.EmailService;
import top.appx.vo.EmailVO;
import top.appx.vo.Pager;
import top.appx.vo.ResultVO;

import javax.annotation.Resource;

/**
 * Created by zwyhome on 2015/6/17.
 */
@Controller
public class EmailController {

    @Resource
    private EmailService emailService;



    @RequestMapping(value= "email/controller",params ="action=queryByPage")
    @ResponseBody
    public Object queryByPage(EmailQO email,int page,int rows){
        Pager<EmailVO> pager = emailService.queryByPage(email,page,rows);
        return pager;
    }

    @RequestMapping(value="email/controller",params = "action=save")
    @ResponseBody
    public ResultVO save(EmailEntity entity) throws Exception {
        emailService.sendEmail(entity);
        return ResultVO.success();
    }
}
